import React, { Component } from 'react'
import {Provider} from '@/assets/js/ctx' // Provider组件
import axios from '@/assets/js/axios' // 配置好的axios

export class Global extends Component {
    constructor(){
        super()

        this.state = {
            axios,
            commonUrl: (process.env.NODE_ENV == 'development') ? 'http://192.168.58.78:8787' : 'http://123.56.85.214:8787'
        }
    }

    render() {
        const {axios,commonUrl} = this.state

        return (
            <Provider value={{
                axios,
                commonUrl
            }}>
                {this.props.children}
            </Provider>
        )
    }
}

export default Global
